﻿@model CashOrCard.Models.AdvtSite

@{
    float rate = 0.5F;
    bool isSet = false;   
    for (int i=0; i < 10; i++)
    {
        
        
        //if(isDisabled)
        //{
        //    disalbedStr = "readOnly = \"readOnly\"";
        //}
        
        if (Model.SiteRate <= rate && !isSet)
        {
            <input class="auto-submit-star {split:2} required" type="radio" name="rating-@Model.AdvtSiteId" value="@rate" checked="checked" />  
            isSet = true;
        }
        else{
            <input class="auto-submit-star {split:2} required" type="radio" name="rating-@Model.AdvtSiteId" value="@rate" /> 
        }
        rate += 0.5F;           
    }

    string disalbedStr = string.Empty;
    bool isDisabled = true;
    if (ViewData["disabled"] != null)
    {
        bool.TryParse(ViewData["disabled"].ToString(), out isDisabled);
    }
    
    if(isDisabled)
    {
        <script>            
            $(function () {
                $("input[name=rating-" + @Model.AdvtSiteId + "]").rating({
                    callback: function (value, link) {
                        RateSubmit(this,value,@Model.AdvtSiteId);                        
                    }
                });
                $("input[name=rating-" + @Model.AdvtSiteId + "]").rating('readOnly', true);
            })
        </script>
    }
    
    bool isShowRateMessage = false;
    if(ViewData["showmsg"] != null)
    {
        bool.TryParse(ViewData["showmsg"].ToString(), out isShowRateMessage);
    }
    
    if(isShowRateMessage){
        <span class="rateMessge" onclick="RateHere('rating-@Model.AdvtSiteId')">(RATE HERE)</span>
    }
}
